<?php

namespace Biz\model;

use Medoo\Medoo;


class ShopErpLog extends \Doraemon\pockets\datebase\BaseDbModel
{

    const _CONFIG_FILE_ = 'db_shop';

    const _CONFIG_SELECT_ = 'db_shop_info';

    const _DATABASE_ = 'shop_info';

    const _TABLE_NAME = 'shop_erp_log';

    const _SUB_TABLE = false;

    public static function getByWhere($method, $fields, $where = '')
    {
        return self::$method($fields, $where);
    }

    public static function saveByWhere($method, $data, $where = '')
    {
        $ret = [];
        try {
            switch ($method) {
                case 'insert':
                    $ret = self::insert($data);
                    break;
                case 'update':
                    $ret = self::update($data, $where);
            }
            if ($ret->errorCode() !== '00000') {
                throw new \Exception('操作失败,请重试');
            }
            return $ret;

        } catch (\Exception $e) {
            throw $e;
        }
    }

}

